import storage from "@/utils/storage";
import {
	http,
	Method
} from "@/utils/request.js";


/**
 * 获取当前登录的用户信息
 * @returns {AxiosPromise}
 */
export function getUserInfo() {
	return http.request({
		url: "/api/account/info",
		method: Method.GET,
		needToken: true,
	});
}


/**
 * 添加收藏
 * @returns {AxiosPromise}
 */
export function collectionGoods(params) {
	return http.request({
		url: "/api/goods/addFavorite",
		method: Method.POST,
		data: params
	});
}

/**
 * 取消收藏
 * @returns {AxiosPromise}
 */
export function deleteGoodsCollection(params) {
	return http.request({
		url: "/api/goods/removeFavorite",
		method: Method.POST,
		data: params
	});
}

/**
 * 收藏列表
 * @returns {AxiosPromise}
 */
export function favoriteList(params) {
	return http.request({
		url: "/api/goods/favoriteList",
		method: Method.GET,
		params
	});
}